const express = require('express');
const router = express.Router();
const {asyncHandler} = require('../utils/sendResult');
const {getMoveAboutByPage,addMoveAbout, getMoveAboutById,editMoveAbout} = require("../services/moveAboutServices");
const {editUserInfoById} =  require("../services/userServices")
router.get("/",asyncHandler((req,res,next)=>{
    // 分页查询招募信息
    return getMoveAboutByPage(req.query)
}))

// 用户收藏此招募信息
router.post("/collect",asyncHandler((req,res,next)=>{
    return editUserInfoById(req.userInfo._id,req.body)
}))

// 添加招募信息
router.post("/",asyncHandler((req,res,next)=>{
    return addMoveAbout(req.body)
}))

// 通过ID获取招募详情
router.get("/:id",asyncHandler((req,res,next)=>{
    return getMoveAboutById(req.params.id)
}))

// 修改招募信息
router.post("/:id",asyncHandler((req,res,next)=>{
    return editMoveAbout(req.params.id,req.body)
}))




module.exports = router;
